/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.actions;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ActionConfig extends ActionSupport{
    
	//teste
    private String res;
    private String dir;

    public String config(){
        File cfg = new File(System.getProperty("user.dir") + "/esBox.inf");
        if(!cfg.exists()){
        	if(res.startsWith("Especificar")){
        		File newDir = new File(dir);
        		if(!newDir.exists())
        			return ERROR;
        		res = dir;
        	}else
        		res = res.split(" ")[0];
			try {
				FileWriter fw = new FileWriter(cfg);
	        	fw.write(res);
	        	fw.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
        }
        return SUCCESS;
    }
    
}
